<?php

/**
 * This is the model class for table "tbl_rel_ingreso_turno".
 *
 * The followings are the available columns in table 'tbl_rel_ingreso_turno':
 * @property string $intu_periodoingreso_id
 * @property string $intu_programaacademico_id
 * @property integer $intu_turno_id
 * @property integer $intu_cupoingreso
 */
class IngresoTurno extends CActiveRecord
{
	public $intu_turno_nombre;
	
	/**
	 * Returns the static model of the specified AR class.
	 * @return IngresoTurno the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'tbl_rel_ingreso_turno';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('intu_periodoingreso_id, intu_programaacademico_id, intu_turno_id, intu_cupoingreso', 'required'),
			array('intu_turno_id, intu_cupoingreso', 'numerical', 'integerOnly'=>true),
			array('intu_periodoingreso_id, intu_programaacademico_id', 'length', 'max'=>20),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('intu_periodoingreso_id, intu_programaacademico_id, intu_turno_id, intu_cupoingreso,intu_turno_nombre', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'turno' => array(self::BELONGS_TO, 'Turno', 'intu_turno_id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'intu_periodoingreso_id' => 'Intu Periodoingreso',
			'intu_programaacademico_id' => 'Intu Programaacademico',
			'intu_turno_id' => 'Intu Turno',
			'intu_cupoingreso' => 'Intu Cupoingreso',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('intu_periodoingreso_id',$this->intu_periodoingreso_id,true);
		$criteria->compare('intu_programaacademico_id',$this->intu_programaacademico_id,true);
		$criteria->compare('intu_turno_id',$this->intu_turno_id);
		$criteria->compare('intu_cupoingreso',$this->intu_cupoingreso);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}